<%@ page import="org.apache.ibatis.session.SqlSession" %>
<%@ page import="cn.java71.util.MyBatisUtil" %>
<%@ page import="cn.java71.dao.StudentDao" %><%--
  Created by IntelliJ IDEA.
  User: oldliu
  Date: 2021/1/27
  Time: 15:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
 <%
     //删除谁
     //拿到学号
    long stuno=Long.parseLong(request.getParameter("stuno"));
     SqlSession s= MyBatisUtil.get();
     StudentDao dao=s.getMapper(StudentDao.class);
     try {
         int res = dao.del(stuno);
         if (res > 0) {
             out.print("删除成功<a href='students.jsp'>返回</a>");
         } else {
             out.print("删除失败<a href='students.jsp'>返回</a>");
         }
     }catch (Exception e){
            out.print("删除失败,这个学生还要用<a href='students.jsp'>返回</a>");
     }
     MyBatisUtil.close(s);
 %>
</body>
</html>
